using System;
using System.ServiceModel.Activation;
using System.ServiceModel;

namespace Sogeti.Guidelines.WCF.Hosting
{
    public class CommonServiceHostFactory<TContainerProvider> : ServiceHostFactoryBase
        where TContainerProvider : IContainerProvider
    {
        public override ServiceHostBase CreateServiceHost(string constructorString, Uri[] baseAddresses)
        {
            var serviceType = Type.GetType(constructorString, true);
            var host = new CommonServiceHost<TContainerProvider>(serviceType, baseAddresses);
            return host;
        }
    }
}